home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / newmake.arc / OSDATE.ASM < prev    next >
Encoding:
Assembly Source File  |  1986-09-21  |  1.1 KB  |  64 lines

  1. dos    =    21h
  2.  
  3. arg1    =    4            ; lattice argument indexes
  4. arg2    =    arg1+2
  5. arg3    =    arg2+2
  6.  
  7. pgroup    group    prog
  8. prog    segment byte public 'prog'
  9.     public    osdate
  10.     assume    cs:pgroup
  11.  
  12. ;
  13. ;------
  14. ; OSDATE - return file's creation-date (called from Lattice), or -1
  15. ;       if can't find the file.
  16. ; Synopsis:
  17. ;        int osdate(filename, time1, time2)
  18. ;            char *filename;
  19. ;            int *time1, *time2;
  20. ;
  21. osdate proc near
  22.     push    bp
  23.     mov    bp,sp
  24.  
  25. ;--- Open the file
  26.     mov    dx,[bp+arg1]
  27.     xor    al,al
  28.     mov    ah,3dh
  29.     int    dos
  30.     jc    osd$err         ; can't, so complain
  31.  
  32. ;--- Get file's creation date and time
  33.     mov    bx,ax            ; get handle's date info
  34.     xor    al,al
  35.     mov    ah,57h
  36.     int    dos
  37.     jc    osd$cls         ; "can't happen" (but close it)
  38.  
  39. ;--- Install date/time info into caller's variables
  40.     mov    si,[bp+arg2]        ; *arg2 = time (least significant)
  41.     mov    [si],cx
  42.     mov    si,[bp+arg3]        ; *arg3 = date (most significant)
  43.     mov    [si],dx
  44.  
  45. ;--- Close file & return (ok)
  46.     mov    ah,3eh
  47.     int    dos
  48.     xor    ax,ax
  49.     pop    bp
  50.     ret
  51.  
  52. ;--- Close file & return error condition
  53. osd$cls:
  54.     mov    ah,3eh
  55.     int    dos
  56. osd$err:
  57.     mov    ax,-1
  58.     pop    bp
  59.     ret
  60. osdate endp
  61.  
  62. prog    ends
  63.     end
  64.